{smcl}
{com}{sf}{ul off}{txt}{.-}
      name:  {res}<unnamed>
       {txt}log:  {res}C:\Users\Jungyeon PARK\Dropbox\Discrimination Project_for me\FEVS_FACTOR SCORES_ORG FAIRNESS\2012_FEVS_Log.smcl
  {txt}log type:  {res}smcl
 {txt}opened on:  {res}10 Oct 2021, 14:28:22

{com}. do "C:\Users\JUNGYE~1\AppData\Local\Temp\STD10c4_000000.tmp"
{txt}
{com}. import delimited "C:\Users\Jungyeon PARK\Dropbox\DISCRIMINATION PROJECT (U.S. FEDERAL AGENCIES)\FEVS\FEVS_2010-2019\FEVS2012_PRDF.csv
{res}{text}(97 vars, 687,687 obs)

{com}. 
. svyset [pweight=postwt]

      {txt}pweight:{col 16}{res}postwt
          {txt}VCE:{col 16}{res}linearized
  {txt}Single unit:{col 16}{res}missing
     {txt}Strata 1:{col 16}<one>
         SU 1:{col 16}<observations>
        FPC 1:{col 16}<zero>
{p2colreset}{...}

{com}. 
. drop if q17=="X"
{txt}(27,152 observations deleted)

{com}. 
. drop if q17==""
{txt}(4,078 observations deleted)

{com}. 
. drop if q37=="X"
{txt}(26,254 observations deleted)

{com}. 
. drop if q37==""
{txt}(16,967 observations deleted)

{com}. 
. drop if q38=="X"
{txt}(26,450 observations deleted)

{com}. 
. drop if q38==""
{txt}(3,854 observations deleted)

{com}. 
. destring q17, replace
{txt}q17: all characters numeric; {res}replaced {txt}as {res}byte
{txt}
{com}. 
. destring q37, replace
{txt}q37: all characters numeric; {res}replaced {txt}as {res}byte
{txt}
{com}. 
. destring q38, replace
{txt}q38: all characters numeric; {res}replaced {txt}as {res}byte
{txt}
{com}. 
. svy linearized : gsem (FAIRNESS -> q17, family(ordinal) link(logit)) (FAIRNESS -> q37, family(ordinal) link(logit)) (FAIRNESS -> q38, family(ordinal) link(logit)), covstruct(_lexogenous, diagonal) latent(FAIRNESS) nocapslatent
{txt}(running gsem on estimation sample)
{res}
{txt}Survey: Generalized structural equation model

{col 1}Number of strata{col 20}= {res}        1{txt}{col 49}Number of obs{col 67}= {res}   582,932
{txt}{col 1}Number of PSUs{col 20}= {res}  582,932{txt}{col 49}Population size{col 67}={res}  1,582,749
{txt}{col 49}Design df{col 67}= {res}   582,931

{txt}Response{col 16}: {res}q17
{txt}Family{col 16}: {res}ordinal
{txt}Link{col 16}: {res}logit

{txt}Response{col 16}: {res}q37
{txt}Family{col 16}: {res}ordinal
{txt}Link{col 16}: {res}logit

{txt}Response{col 16}: {res}q38
{txt}Family{col 16}: {res}ordinal
{txt}Link{col 16}: {res}logit

{p 0 7}{space 1}{text:( 1)}{space 1} [q17]FAIRNESS = 1{p_end}
{txt}{hline 14}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 15}{c |}{col 27}  Linearized
{col 15}{c |}      Coef.{col 27}   Std. Err.{col 39}      t{col 47}   P>|t|{col 55}     [95% Con{col 68}f. Interval]
{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}q17           {txt}{c |}
{space 5}FAIRNESS {c |}{col 15}{res}{space 2}        1{col 27}{txt}  (constrained)
{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}q37           {txt}{c |}
{space 5}FAIRNESS {c |}{col 15}{res}{space 2} 1.796981{col 27}{space 2} .0141743{col 38}{space 1}  126.78{col 47}{space 3}0.000{col 55}{space 4}   1.7692{col 68}{space 3} 1.824762
{txt}{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}q38           {txt}{c |}
{space 5}FAIRNESS {c |}{col 15}{res}{space 2} 2.089435{col 27}{space 2} .0212321{col 38}{space 1}   98.41{col 47}{space 3}0.000{col 55}{space 4} 2.047821{col 68}{space 3} 2.131049
{txt}{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}/q17          {txt}{c |}
{space 9}cut1 {c |}{col 15}{res}{space 2}-3.425345{col 27}{space 2} .0118415{col 55}{space 4}-3.448554{col 68}{space 3}-3.402136
{txt}{space 9}cut2 {c |}{col 15}{res}{space 2}-2.270536{col 27}{space 2} .0090063{col 55}{space 4}-2.288188{col 68}{space 3}-2.252884
{txt}{space 9}cut3 {c |}{col 15}{res}{space 2}-.8015581{col 27}{space 2} .0069319{col 55}{space 4}-.8151443{col 68}{space 3}-.7879718
{txt}{space 9}cut4 {c |}{col 15}{res}{space 2}  1.77709{col 27}{space 2} .0084696{col 55}{space 4}  1.76049{col 68}{space 3}  1.79369
{txt}{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}/q37          {txt}{c |}
{space 9}cut1 {c |}{col 15}{res}{space 2}-4.521404{col 27}{space 2} .0259375{col 55}{space 4}-4.572241{col 68}{space 3}-4.470567
{txt}{space 9}cut2 {c |}{col 15}{res}{space 2}-2.739733{col 27}{space 2} .0178481{col 55}{space 4}-2.774715{col 68}{space 3}-2.704752
{txt}{space 9}cut3 {c |}{col 15}{res}{space 2} -.360789{col 27}{space 2}  .010341{col 55}{space 4}-.3810569{col 68}{space 3}-.3405211
{txt}{space 9}cut4 {c |}{col 15}{res}{space 2} 3.716783{col 27}{space 2} .0221908{col 55}{space 4}  3.67329{col 68}{space 3} 3.760276
{txt}{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}/q38          {txt}{c |}
{space 9}cut1 {c |}{col 15}{res}{space 2}-6.380166{col 27}{space 2} .0480855{col 55}{space 4}-6.474412{col 68}{space 3} -6.28592
{txt}{space 9}cut2 {c |}{col 15}{res}{space 2}-4.709097{col 27}{space 2}  .036688{col 55}{space 4}-4.781004{col 68}{space 3}-4.637189
{txt}{space 9}cut3 {c |}{col 15}{res}{space 2} -1.79629{col 27}{space 2} .0177464{col 55}{space 4}-1.831072{col 68}{space 3}-1.761507
{txt}{space 9}cut4 {c |}{col 15}{res}{space 2} 3.120809{col 27}{space 2} .0253479{col 55}{space 4} 3.071127{col 68}{space 3}  3.17049
{txt}{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 1}var(FAIRNESS){c |}{col 15}{res}{space 2} 3.837045{col 27}{space 2} .0360564{col 55}{space 4} 3.767022{col 68}{space 3} 3.908369
{txt}{hline 14}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}

{com}. 
. predict fairnessgsem, latent(FAIRNESS)
{txt}(option {bf:ebmeans} assumed)
{res}{txt}(using 7 quadrature points)

{com}. 
. egen average_fairnessgsem = mean (fairnessgsem), by (agency)
{txt}
{com}. 
. egen sub_average_fairnessgsem = mean (fairnessgsem), by (subelem)
{txt}
{com}. 
. svy linearized : sem (FAIRNESSSEM -> q38 q37 q17), covstruct(_lexogenous, diagonal) standardized latent(FAIRNESSSEM) nocapslatent
{txt}(running sem on estimation sample)
{res}
{txt}{col 1}Survey: Structural equation model{col 49}Number of obs{col 67}= {res}   582,932
{txt}{col 1}Number of strata{col 22}= {res}        1{txt}{col 49}Population size{col 67}={res}  1,582,749
{txt}{col 1}Number of PSUs{col 22}= {res}  582,932{txt}{col 49}Design df{col 67}= {res}   582,931

{p 0 7}{space 1}{text:( 1)}{space 1} [q38]FAIRNESSSEM = 1{p_end}
{txt}{hline 16}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 17}{c |}{col 29}  Linearized
{col 1}   Standardized{col 17}{c |}      Coef.{col 29}   Std. Err.{col 41}      t{col 49}   P>|t|{col 57}     [95% Con{col 70}f. Interval]
{hline 16}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}{res}Measurement    {col 17}{txt}{c |}
{space 2}{col 3}q38          {col 17}{c |}
{space 4}FAIRNESSSEM {c |}{col 17}{res}{space 2} .8545444{col 29}{space 2} .0014185{col 40}{space 1}  602.41{col 49}{space 3}0.000{col 57}{space 4} .8517641{col 70}{space 3} .8573247
{txt}{space 10}_cons {c |}{col 17}{res}{space 2} 3.287415{col 29}{space 2} .0071574{col 40}{space 1}  459.31{col 49}{space 3}0.000{col 57}{space 4} 3.273387{col 70}{space 3} 3.301443
{space 2}{txt}{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 2}{col 3}q37          {col 17}{c |}
{space 4}FAIRNESSSEM {c |}{col 17}{res}{space 2} .8429622{col 29}{space 2} .0013981{col 40}{space 1}  602.92{col 49}{space 3}0.000{col 57}{space 4}  .840222{col 70}{space 3} .8457025
{txt}{space 10}_cons {c |}{col 17}{res}{space 2} 2.705494{col 29}{space 2}   .00478{col 40}{space 1}  566.00{col 49}{space 3}0.000{col 57}{space 4} 2.696125{col 70}{space 3} 2.714863
{space 2}{txt}{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 2}{col 3}q17          {col 17}{c |}
{space 4}FAIRNESSSEM {c |}{col 17}{res}{space 2} .6952529{col 29}{space 2} .0017547{col 40}{space 1}  396.22{col 49}{space 3}0.000{col 57}{space 4} .6918137{col 70}{space 3} .6986921
{txt}{space 10}_cons {c |}{col 17}{res}{space 2} 2.956952{col 29}{space 2} .0057044{col 40}{space 1}  518.36{col 49}{space 3}0.000{col 57}{space 4} 2.945771{col 70}{space 3} 2.968132
{txt}{hline 16}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 6}var(e.q38){c |}{col 17}{res}{space 2} .2697539{col 29}{space 2} .0024244{col 57}{space 4} .2650437{col 70}{space 3} .2745478
{txt}{space 6}var(e.q37){c |}{col 17}{res}{space 2} .2894147{col 29}{space 2} .0023571{col 57}{space 4} .2848315{col 70}{space 3} .2940716
{txt}{space 6}var(e.q17){c |}{col 17}{res}{space 2} .5166234{col 29}{space 2} .0024399{col 57}{space 4} .5118633{col 70}{space 3} .5214278
{txt}var(FAIRNESSSEM){c |}{col 17}{res}{space 2}        1{col 29}{space 2}        .{col 57}{space 4}        .{col 70}{space 3}        .
{txt}{hline 16}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}

{com}. 
. estat gof, stats(all)
{res}
{txt}{hline 21}{c TT}{hline 54}
{lalign 21:Fit statistic}{c |}      Value   Description
{hline 21}{c +}{hline 54}
{lalign 21:Size of residuals}{c |}
{ralign 20:SRMR} {c |} {res}{ralign 10:     0.000}{txt}   Standardized root mean squared residual
{ralign 20:CD} {c |} {res}{ralign 10:     0.859}{txt}   Coefficient of determination
{hline 21}{c BT}{hline 54}
{p 0 2 2 75}Note: model was fit with{txt} svy: prefix; only stats(residuals) valid.{p_end}

{com}. 
. predict fairnesssem, latent(FAIRNESSSEM)
{res}{txt}
{com}. 
. egen average_fairnesssem = mean (fairnesssem), by (agency)
{txt}
{com}. 
. egen sub_average_fairnesssem = mean (fairnesssem), by (subelem)
{txt}
{com}. 
. correlate fairnessgsem fairnesssem
{txt}(obs=582,932)

             {c |} fai~gsem fai~ssem
{hline 13}{c +}{hline 18}
fairnessgsem {c |}{res}   1.0000
 {txt}fairnesssem {c |}{res}   0.9810   1.0000

{txt}
{com}. 
{txt}end of do-file

{com}. save "C:\Users\Jungyeon PARK\Dropbox\Discrimination Project_for me\FEVS_FACTOR SCORES_ORG FAIRNESS\2012_FEVS_DATA.dta"
{txt}file C:\Users\Jungyeon PARK\Dropbox\Discrimination Project_for me\FEVS_FACTOR SCORES_ORG FAIRNESS\2012_FEVS_DATA.dta saved

{com}. log close
      {txt}name:  {res}<unnamed>
       {txt}log:  {res}C:\Users\Jungyeon PARK\Dropbox\Discrimination Project_for me\FEVS_FACTOR SCORES_ORG FAIRNESS\2012_FEVS_Log.smcl
  {txt}log type:  {res}smcl
 {txt}closed on:  {res}10 Oct 2021, 14:37:18
{txt}{.-}
{smcl}
{txt}{sf}{ul off}